package day05.StringBuiders;

/**
 * @author yangwenqi
 * @decs TODO
 * @date 2025/4/26
 */
public class Test3 {
    public static void main(String[] args) {
        int[] arr = {1, 2, 3};
        String result = arrayToString(arr);
        System.out.println(result);
    }

    public static String arrayToString(int[] arr) {
        StringBuilder sb = new StringBuilder();
        sb.append("[");
        for (int i = 0; i < arr.length; i++) {
            if (i > 0) {
                sb.append(", ");
            }
            sb.append(arr[i]);
        }
        sb.append("]");
        return sb.toString();
    }
    }
